#ifndef CLIENTTHREAD_H
#define CLIENTTHREAD_H

#include <QThread>
#include <QTcpServer>
#include <QSslSocket>

#include "clientsocket.h"
#include "commandparser.h"

class ClientThread : public QThread
{
    Q_OBJECT
	volatile qint64 m_clientsCount;
	CommandParser m_parser;
public:
    explicit ClientThread(QObject *parent = 0);
	~ClientThread();

private:
	void _startServerEncryption( ClientSocket* socket );
	void _connectSocketSignals( ClientSocket* socket );

private slots:
	void unbindSocket();

public slots:
	void bindSocket(int socketDescriptor);

private slots:

	void slot_encrypted ();
	void slot_encryptedBytesWritten (qint64 written);
	void slot_modeChanged (QSslSocket::SslMode mode);
	void slot_peerVerifyError (const QSslError &error);
	void slot_sslErrors (const QList<QSslError> &errors);

	void slot_connected ();
	void slot_disconnected ();
	void slot_error (QAbstractSocket::SocketError);
	void slot_hostFound ();
	void slot_proxyAuthenticationRequired (const QNetworkProxy &,
										   QAuthenticator *);
	void slot_stateChanged (QAbstractSocket::SocketState);
};

#endif // CLIENTTHREAD_H
